﻿Imports System.Configuration
Public Class MyConfig
    Private Shared _config As System.Configuration.Configuration

    Public Sub New()
        If _config Is Nothing Then
            _config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
        End If
    End Sub

    Public Property 用户名() As String
        Get
            Return _config.AppSettings.Settings("username").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("username").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 密码() As String
        Get
            Return _config.AppSettings.Settings("password").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("password").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 每天的留言个数() As String
        Get
            Return _config.AppSettings.Settings("CommentCount").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("CommentCount").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 每天访问空间的个数() As String
        Get
            Return _config.AppSettings.Settings("AccessCount").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("AccessCount").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 每天打招呼的个数() As String
        Get
            Return _config.AppSettings.Settings("SayHelloCount").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("SayHelloCount").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 每天加为关注的个数() As String
        Get
            Return _config.AppSettings.Settings("SetFocusCount").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("SetFocusCount").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 每天加为朋友的个数() As String
        Get
            Return _config.AppSettings.Settings("AddFriend").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("AddFriend").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 是否使用代理服务器() As Boolean
        Get
            Return _config.AppSettings.Settings("Proxy").Value = "1"
        End Get
        Set(ByVal value As Boolean)
            If value = True Then
                _config.AppSettings.Settings("Proxy").Value = "1"
            Else
                _config.AppSettings.Settings("Proxy").Value = "0"
            End If
            _config.Save()
        End Set
    End Property

    Public Property IP地址() As String
        Get
            Return _config.AppSettings.Settings("ProxyIp").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("ProxyIp").Value = value
            _config.Save()
        End Set
    End Property

    Public Property IP端口() As String
        Get
            Return _config.AppSettings.Settings("ProxyPort").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("ProxyPort").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 登陆后采集的动作() As String
        Get
            Return _config.AppSettings.Settings("login_collect").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("login_collect").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 登陆后留言的动作() As String
        Get
            Return _config.AppSettings.Settings("login_space").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("login_space").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 是否自动登陆() As Boolean
        Get
            Return _config.AppSettings.Settings("AutoLogin").Value = "1"
        End Get
        Set(ByVal value As Boolean)
            If value = True Then
                _config.AppSettings.Settings("AutoLogin").Value = "1"
            Else
                _config.AppSettings.Settings("AutoLogin").Value = "0"
            End If
            _config.Save()
        End Set
    End Property

    Public Property 最大朋友() As String
        Get
            Return _config.AppSettings.Settings("MaxFriend").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("MaxFriend").Value = value
            _config.Save()
        End Set
    End Property

    Public Property 最大关注() As String
        Get
            Return _config.AppSettings.Settings("MaxSetFocus").Value
        End Get
        Set(ByVal value As String)
            _config.AppSettings.Settings("MaxSetFocus").Value = value
            _config.Save()
        End Set
    End Property
End Class
